togglebutton: Remove unneeded code
authorBenjamin Otte <otte@redhat.com>
Fri, 15 Aug 2014 22:45:00 +0000 (00:45 +0200)
committerBenjamin Otte <otte@redhat.com>
Sat, 16 Aug 2014 14:34:16 +0000 (16:34 +0200)
The state is completely handled by gtkbutton.c so no need to do anything
in the togglebutton.

gtk/gtktogglebutton.c

index ebd99cae62dcdf7fbbc2fd0e81a848435c1f1a4f..d766f19ca3fd2b73d85509036d521bb15b8adb0f 100644 (file)
@@ -133,8 +133,6 @@ static void gtk_toggle_button_get_property  (GObject              *object,
                                             guint                 prop_id,
                                             GValue               *value,
                                             GParamSpec           *pspec);
-static void gtk_toggle_button_update_state  (GtkButton            *button);
-static void gtk_toggle_button_enter_leave   (GtkButton            *button);
 
 
 static void gtk_toggle_button_activatable_interface_init (GtkActivatableIface  *iface);
@@ -171,8 +169,6 @@ gtk_toggle_button_class_init (GtkToggleButtonClass *class)
   widget_class->mnemonic_activate = gtk_toggle_button_mnemonic_activate;
 
   button_class->clicked = gtk_toggle_button_clicked;
-  button_class->enter = gtk_toggle_button_enter_leave;
-  button_class->leave = gtk_toggle_button_enter_leave;
 
   class->toggled = NULL;
 
@@ -608,36 +604,9 @@ gtk_toggle_button_clicked (GtkButton *button)
 
   gtk_toggle_button_toggled (toggle_button);
 
-  gtk_toggle_button_update_state (button);
-
   g_object_notify (G_OBJECT (toggle_button), "active");
 
   if (GTK_BUTTON_CLASS (gtk_toggle_button_parent_class)->clicked)
     GTK_BUTTON_CLASS (gtk_toggle_button_parent_class)->clicked (button);
 }
 
-static void
-gtk_toggle_button_enter_leave (GtkButton *button)
-{
-  gtk_toggle_button_update_state (button);
-  gtk_widget_queue_draw (GTK_WIDGET (button));
-}
-
-static void
-gtk_toggle_button_update_state (GtkButton *button)
-{
-  GtkToggleButton *toggle_button = GTK_TOGGLE_BUTTON (button);
-  GtkStateFlags new_state = 0;
-
-  new_state = gtk_widget_get_state_flags (GTK_WIDGET (button)) &
-    ~(GTK_STATE_FLAG_PRELIGHT |
-      GTK_STATE_FLAG_ACTIVE);
-
-  if (button->priv->in_button && button->priv->button_down)
-    new_state |= GTK_STATE_FLAG_ACTIVE;
-
-  if (button->priv->in_button)
-    new_state |= GTK_STATE_FLAG_PRELIGHT;
-
-  gtk_widget_set_state_flags (GTK_WIDGET (toggle_button), new_state, TRUE);
-}